﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EzDesk.EzAppApi.Web.Utility.Controllers;
using EzDesk.EzAppApi.Web.Utility.Attributes;
using EzDesk.EzAppApi.Utility.Models;
using System.Text;

namespace EzDesk.Message.DesktopWeb.Controllers
{
    public class MessageController : EzAppController
    {

        public ActionResult Index()
        {
            return View();
        }

        [HttpGet]
        [EzDeskAppSessionAuthorize]
        public ContentResult Task(Guid? userId)
        {
            AppTaskCollection taskCollection = new AppTaskCollection();
            taskCollection.AddTask("发布公共消息", "发布一条面向所有人的公共消息", "/message/send");
            taskCollection.AddTask("自定义发送消息", "发布一条自定义消息，可以自由选择消息接受对象", "/message/choosePerson");

            ViewData.Model = taskCollection;
            Response.ContentType = "";
            return new ContentResult()
            {
                ContentType = "text/xml",
                ContentEncoding = Encoding.UTF8,
                Content = taskCollection.ToXmlString(),
            };
        }

        [HttpGet]
        [EzDeskAppSessionAuthorize]
        public ActionResult Send()
        {
            return View();
        }

    }
}
